<script setup>
import { Close, Minus } from "@element-plus/icons-vue";
import { ref } from "vue";
import { ipcRendererSend } from "@/utils/ipcRenderer";
const props = defineProps(["title"]);

const clickBar = (num) => {
  if (num == 1) {
    ipcRendererSend("window-min", {});
  } else {
    ipcRendererSend("close-windows", { isQuit: 0 });
  }
};
</script>

<template>
  <div class="container">
    <div class="left">{{ title }}</div>
    <div class="right">
      <el-icon :size="18" @click="clickBar(1)" class="click-icon click-home">
        <Minus />
      </el-icon>
      <el-icon
        :size="20"
        @click="clickBar(3)"
        class="click-icon close-icon click-home"
      >
        <Close />
      </el-icon>
    </div>
  </div>
</template>

<style scoped lang="scss">
.container {
  width: 100%;
  height: 40px;
  padding: 0 20px;
  position: fixed;
  top: 0;
  left: 0;
  box-sizing: border-box;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  -webkit-app-region: drag;
  .left {
    font-size: 20px;
    font-weight: 600;
  }
  .right {
    .click-icon {
      width: 34px;
      height: 34px;
      -webkit-app-region: no-drag;
      margin-left: 20px;
      color: #666;
    }
    .click-icon:hover {
      color: #560d9b;
      background: #eee;
    }
    .close-icon {
      transition: all 0.3s;
    }
    .close-icon:hover {
      background-color: #e61123;
      color: #fff;
    }
  }
}
</style>
